<template>
  <el-container>
    <el-header>
      <el-col :span="12">
        <i
          :class="{
            'el-icon-s-fold': this.isCollapse,
            'el-icon-s-unfold': !this.isCollapse,
          }"
          @click="toggleAside"
        ></i>
        权限管理系统
      </el-col>
      <el-col :span="12"> </el-col>
    </el-header>
    <el-container>
      <el-aside width="auto">
        <el-menu
          default-active="/Admin"
          class="el-menu-vertical-demo"
          @open="handleOpen"
          @close="handleClose"
          :collapse="isCollapse"
          active-text-color="#478cf1"
          :unique-opened="true"
          :router="true"
        >
          <el-submenu index="1">
            <template slot="title">
              <i class="el-icon-location"></i>
              <span slot="title">用户管理</span>
            </template>
            <el-menu-item index="/Admin">用户管理</el-menu-item>
          </el-submenu>
          <el-submenu index="2">
            <template slot="title">
              <i class="el-icon-location"></i>
              <span slot="title">角色管理</span>
            </template>
            <el-menu-item index="/Role">角色管理</el-menu-item>
          </el-submenu>
        </el-menu>
      </el-aside>
      <el-main>
        <router-view/>
      </el-main>
    </el-container>
  </el-container>
</template>

<script>
export default {
  name: 'RbacpermissionsystemUiHome',

  data () {
    return {
      isCollapse: false,
      icon: 'el-icon-s-fold'
    }
  },

  mounted () {},

  methods: {
    handleOpen (key, keyPath) {
      console.log(key, keyPath)
    },
    handleClose (key, keyPath) {
      console.log(key, keyPath)
    },
    toggleAside () {
      this.isCollapse = !this.isCollapse
      this.icon = this.isCollapse ? 'el-icon-s-fold' : 'el-icon-s-unfold'
    }
  }
}
</script>
<style>
.el-header {
  color: #333;
  text-align: left;
  line-height: 60px;
  font-weight: bold;
  font-size: 18px;
  border-bottom: 1px solid #d3dce6;
}

.el-aside {
  color: #333;
  height: calc(100vh - 100px);
  height: 100vh;
}

.el-main {
  background-color: #fff;
  color: #333;
}

body > .el-container {
  margin-bottom: 40px;
}

.el-menu-vertical-demo:not(.el-menu--collapse) {
  width: 200px;
  min-height: 400px;
}

.el-menu {
  height: 100%;
}
</style>
